/**
    Copyright 2008, Mark Arvidson
    
    This file is part of EwaScorecard.

    EwaScorecard is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    EwaScorecard is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with EwaScorecard.  If not, see <http://www.gnu.org/licenses/>.
*/
import javax.microedition.lcdui.*;

public class AboutForm extends Form implements CommandListener {
    private Command okCommand = new Command("OK", Command.OK, 1);
    private Command linkCommand = new Command("Open", Command.ITEM, 1);
    private Command projectCommand = new Command("Open", Command.ITEM,1);
    private StringItem linkItem = new StringItem(null,"http://www.gnu.org/licenses/", Item.HYPERLINK);
    private StringItem projectItem = (new StringItem("EwaScorecard v2.0","Copyright (C) 2008 Mark A. Arvidson",Item.HYPERLINK));
    private EwaScorecard host;
    
    public AboutForm(EwaScorecard host) {
        super("About EwaScorecard");
        this.host = host;
        linkItem.setDefaultCommand(linkCommand);
	projectItem.setDefaultCommand(projectCommand);
        append(projectItem);
        append(new StringItem(null,"This program is distributed under a GPL v3 license."));
        append(new StringItem(null,"This program comes with ABSOLUTELY NO WARRANTY."));
        append(new StringItem(null,"This is free software, and you are welcome to redistribute it under certain conditions."));
        append(new StringItem(null,"For more information, see"));
        append(linkItem);
        addCommand(okCommand);
        setCommandListener(this);
    }
    
    public void commandAction(Command c,  Displayable d) {
	if (c == linkCommand) {
	    try {
		host.platformRequest("http://www.gnu.org/licenses/");
	    } catch (Exception e) { e.printStackTrace();}
	    return;
	} 
	if (c == projectCommand) {
	    try {
		host.platformRequest("http://code.google.com/p/ewascorecard/");
	    } catch (Exception e) { e.printStackTrace();}
	    return;
	} 

	host.mainMenu();
    }
}
